home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 3.iso / dist / fw_bind.idb / usr / freeware / include / bind / isc / logging.h.z / logging.h
Encoding:
C/C++ Source or Header  |  2001-04-12  |  3.7 KB  |  103 lines

  1. /*
  2.  * Copyright (c) 1996-1999 by Internet Software Consortium.
  3.  *
  4.  * Permission to use, copy, modify, and distribute this software for any
  5.  * purpose with or without fee is hereby granted, provided that the above
  6.  * copyright notice and this permission notice appear in all copies.
  7.  *
  8.  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
  9.  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
  10.  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
  11.  * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12.  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  13.  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  14.  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  15.  * SOFTWARE.
  16.  */
  17.  
  18. #ifndef LOGGING_H
  19. #define LOGGING_H
  20.  
  21. #include <sys/types.h>
  22. #include <stdio.h>
  23. #include <stdarg.h>
  24. #include <unistd.h>
  25.  
  26. #define log_critical        (-5)
  27. #define log_error           (-4)
  28. #define log_warning         (-3)
  29. #define log_notice          (-2)
  30. #define log_info          (-1)
  31. #define log_debug(level)    (level)
  32.  
  33. typedef enum { log_syslog, log_file, log_null } log_channel_type;
  34.  
  35. #define LOG_MAX_VERSIONS 99
  36.  
  37. #define LOG_CLOSE_STREAM        0x0001
  38. #define LOG_TIMESTAMP            0x0002
  39. #define LOG_TRUNCATE            0x0004
  40. #define LOG_USE_CONTEXT_LEVEL        0x0008
  41. #define LOG_PRINT_LEVEL            0x0010
  42. #define LOG_REQUIRE_DEBUG        0x0020
  43. #define LOG_CHANNEL_BROKEN        0x0040
  44. #define LOG_PRINT_CATEGORY        0x0080
  45. #define LOG_CHANNEL_OFF            0x0100
  46.  
  47. typedef struct log_context *log_context;
  48. typedef struct log_channel *log_channel;
  49.  
  50. #define LOG_OPTION_DEBUG        0x01
  51. #define LOG_OPTION_LEVEL        0x02
  52.  
  53. #define log_open_stream        __log_open_stream
  54. #define log_close_stream    __log_close_stream
  55. #define log_get_stream        __log_get_stream
  56. #define log_get_filename    __log_get_filename
  57. #define log_check_channel    __log_check_channel
  58. #define log_check        __log_check
  59. #define log_vwrite        __log_vwrite
  60. #define log_write        __log_write
  61. #define log_new_context        __log_new_context
  62. #define log_free_context    __log_free_context
  63. #define log_add_channel        __log_add_channel
  64. #define log_remove_channel    __log_remove_channel
  65. #define log_option        __log_option
  66. #define log_category_is_active    __log_category_is_active
  67. #define log_new_syslog_channel    __log_new_syslog_channel
  68. #define log_new_file_channel    __log_new_file_channel
  69. #define log_set_file_owner    __log_set_file_owner
  70. #define log_new_null_channel    __log_new_null_channel
  71. #define log_inc_references    __log_inc_references
  72. #define log_dec_references    __log_dec_references
  73. #define log_get_channel_type    __log_get_channel_type
  74. #define log_free_channel    __log_free_channel
  75.  
  76. FILE *            log_open_stream(log_channel);
  77. int            log_close_stream(log_channel);
  78. FILE *            log_get_stream(log_channel);
  79. char *            log_get_filename(log_channel);
  80. int            log_check_channel(log_context, int, log_channel);
  81. int            log_check(log_context, int, int);
  82. void            log_vwrite(log_context, int, int, const char *, 
  83.                    va_list args);
  84. void            log_write(log_context, int, int, const char *, ...);
  85. int            log_new_context(int, char **, log_context *);
  86. void            log_free_context(log_context);
  87. int            log_add_channel(log_context, int, log_channel);
  88. int            log_remove_channel(log_context, int, log_channel);
  89. int            log_option(log_context, int, int);
  90. int            log_category_is_active(log_context, int);
  91. log_channel        log_new_syslog_channel(unsigned int, int, int);
  92. log_channel        log_new_file_channel(unsigned int, int, char *,
  93.                          FILE *, unsigned int,
  94.                          unsigned long);
  95. int            log_set_file_owner(log_channel, uid_t, gid_t);
  96. log_channel        log_new_null_channel(void);
  97. int            log_inc_references(log_channel);
  98. int            log_dec_references(log_channel);
  99. log_channel_type    log_get_channel_type(log_channel);
  100. int            log_free_channel(log_channel);
  101.  
  102. #endif /* !LOGGING_H */
  103.